<template>
  <!-- 侧边栏组件 -->
  <div class="box">
    <div class="background">
      <div :class="{ active: isActive == 1 }" @click="changeclass(1)">首页</div>
<!--      <div :class="{ active: isActive == 2 }" @click="changeclass(2)">推荐</div>-->
<!--      <div :class="{ active: isActive == 3 }" @click="changeclass(3)">关注</div>-->
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
const isActive = ref(1);

const emit = defineEmits(["getValue"]);
function changeclass(i) {
  this.isActive = i;

  emit("getValue", isActive.value);
}

</script>

<style scoped>
.box {
  background-color: red;
  width: 100%;
  padding: 0, 20px;
  padding-bottom: 20px;
}
.background {
  width: 600px;
  height: 30px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
}

.background div {
  width: 80px;
  height: 30px;
  color: white;
  text-align: center;
  padding-top: 10px;
  border-radius: 14px;
  cursor: pointer;
}

.background:nth-child(2) {
  background-color: blue;
}

.active {
  color: red !important;
  background-color: white;
  height: 30px !important;
}

.sort{
    width:50px;
    height: 30px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 50px;
    color: white;
    position: absolute;
    top: 80px;
    left: 10px;
}
</style>